package cn.nuist.service.impl;

import cn.nuist.dao.CustomerDao;
import cn.nuist.entity.Customer;
import cn.nuist.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerServiceImpl implements CustomerService {
    private CustomerDao customerDao;

    @Autowired
    public CustomerServiceImpl(CustomerDao customerDao) {
        this.customerDao = customerDao;
    }

    @Override
    public List<Customer> getAllCustomer() {
        return customerDao.getAllCustomer();
    }

    @Override
    public void addCustomer(Customer customer) {
        customerDao.addCustomer(customer);
    }

    @Override
    public void delete(Integer id) {
        customerDao.deleteCustomer(id);
    }

    @Override
    public Customer getCustomerById(Integer id) {
        return customerDao.getCustomerById(id);
    }

    @Override
    public Customer getCustomerByName(String customerName) {
        return customerDao.getCustomerByName(customerName);
    }

    @Override
    public void update(Customer customer) {
        customerDao.update(customer);
    }
}
